﻿using Microsoft.VisualStudio.TemplateWizard;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SecurableWebFormWizard
{
    public class WindowsServiceWizard : IWizard
    {
        public void BeforeOpeningFile(EnvDTE.ProjectItem projectItem)
        {
            
        }

        public void ProjectFinishedGenerating(EnvDTE.Project project)
        {
            
        }

        public void ProjectItemFinishedGenerating(EnvDTE.ProjectItem projectItem)
        {
            
        }

        public void RunFinished()
        {
            
        }

        public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            //  Create the form.
            WindowsServiceWizardDialog form = new WindowsServiceWizardDialog();

            //  Show the form.
            form.ShowDialog();

            //  Add the options to the replacementsDictionary.
            replacementsDictionary.Add("$ServiceName$", form.ServiceName);
            replacementsDictionary.Add("$Description$", form.Description);
            replacementsDictionary.Add("$DisplayName$", form.DisplayName);
            replacementsDictionary.Add("$Account$", form.Account);
            replacementsDictionary.Add("$UserName$", form.UserName);
            replacementsDictionary.Add("$Password$", form.Password);
            replacementsDictionary.Add("$WorkerThreadRestartDelay$", form.WorkerThreadRestartDelay);
        }

        public bool ShouldAddProjectItem(string filePath)
        {
            return true;
        }
    }
}
